package weibo4andriod.b.a;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public final class c
{
  public static final Object a = new d();
  private Map b;

  public c()
  {
    this.b = new HashMap();
  }

  public c(String paramString)
  {
    this(new f(paramString));
  }

  private c(Map paramMap)
  {
    if (paramMap == null);
    for (Object localObject = new HashMap(); ; localObject = paramMap)
    {
      this.b = ((Map)localObject);
      return;
    }
  }

  public c(f paramf)
  {
    if (paramf.c() != '{')
      throw paramf.a("A JSONObject text must begin with '{'");
    do
    {
      paramf.a();
      String str;
      int i;
      switch (paramf.c())
      {
      default:
        paramf.a();
        str = paramf.d().toString();
        i = paramf.c();
        if (i == 61)
          if (paramf.b() != '>')
            paramf.a();
      case '\0':
        Object localObject;
        do
        {
          localObject = paramf.d();
          if ((str == null) || (localObject == null))
            break label201;
          if (i(str) == null)
            break label164;
          throw new b("Duplicate key \"" + str + "\"");
          throw paramf.a("A JSONObject text must end with '}'");
        }
        while (i == 58);
        throw paramf.a("Expected a ':' after a key");
        if (str == null)
          label164: throw new b("Null key.");
        if (localObject != null)
        {
          b(localObject);
          this.b.put(str, localObject);
        }
        while (true)
          switch (paramf.c())
          {
          default:
            label201: throw paramf.a("Expected a ',' or '}'");
            this.b.remove(str);
          case ',':
          case ';':
          case '}':
          }
      case '}':
      }
    }
    while (paramf.c() != '}');
  }

  private static String a(Number paramNumber)
  {
    if (paramNumber == null)
      throw new b("Null pointer");
    b(paramNumber);
    String str = paramNumber.toString();
    if ((str.indexOf(46) > 0) && (str.indexOf(101) < 0) && (str.indexOf(69) < 0));
    while (true)
    {
      if (!(str.endsWith("0")))
      {
        if (str.endsWith("."))
          str = str.substring(0, str.length() - 1);
        return str;
      }
      str = str.substring(0, str.length() - 1);
    }
  }

  static String a(Object paramObject)
  {
    if ((paramObject == null) || (paramObject.equals(null)));
    for (String str1 = "null"; ; str1 = j(paramObject.toString()))
      while (true)
      {
        return str1;
        if (paramObject instanceof e)
        {
          String str2;
          try
          {
            str2 = ((e)paramObject).a();
            if (!(str2 instanceof String))
              break label59;
            str1 = (String)str2;
          }
          catch (Exception localException)
          {
            throw new b(localException);
          }
          label59: throw new b("Bad value from toJSONString: " + str2);
        }
        if (paramObject instanceof Number)
          str1 = a((Number)paramObject);
        if ((paramObject instanceof Boolean) || (paramObject instanceof c) || (paramObject instanceof a))
          str1 = paramObject.toString();
        if (paramObject instanceof Map)
          str1 = new c((Map)paramObject).toString();
        if (paramObject instanceof Collection)
          str1 = new a((Collection)paramObject).toString();
        if (!(paramObject.getClass().isArray()))
          break;
        str1 = new a(paramObject).toString();
      }
  }

  private static void b(Object paramObject)
  {
    if (paramObject == null)
      return;
    if (paramObject instanceof Double)
    {
      if ((!(((Double)paramObject).isInfinite())) && (!(((Double)paramObject).isNaN())))
        return;
      throw new b("JSON does not allow non-finite numbers.");
    }
    if ((!(paramObject instanceof Float)) || ((!(((Float)paramObject).isInfinite())) && (!(((Float)paramObject).isNaN()))))
      return;
    throw new b("JSON does not allow non-finite numbers.");
  }

  public static Object g(String paramString)
  {
    Object localObject;
    if (paramString.equals(""))
      localObject = paramString;
    while (true)
    {
      return localObject;
      if (paramString.equalsIgnoreCase("true"))
        localObject = Boolean.TRUE;
      if (paramString.equalsIgnoreCase("false"))
        localObject = Boolean.FALSE;
      if (paramString.equalsIgnoreCase("null"))
        localObject = a;
      int i = paramString.charAt(0);
      if (((i >= 48) && (i <= 57)) || ((((i == 46) || (i == 45) || (i == 43))) && (((i != 48) || ((paramString.length() > 2) && (((paramString.charAt(1) == 'x') || (paramString.charAt(1) == 'X'))))))))
        try
        {
          localObject = new Integer(Integer.parseInt(paramString.substring(2), 16));
        }
        catch (Exception localException5)
        {
          try
          {
            label154: localObject = new Integer(paramString);
          }
          catch (Exception localException1)
          {
            try
            {
              localObject = new Long(paramString);
            }
            catch (Exception localException2)
            {
              try
              {
                localObject = new Double(paramString);
              }
              catch (Exception localException3)
              {
                localObject = paramString;
              }
            }
          }
        }
      try
      {
        localObject = new Integer(Integer.parseInt(paramString, 8));
      }
      catch (Exception localException4)
      {
        break label154:
      }
    }
  }

  private double h(String paramString)
  {
    Object localObject = i(paramString);
    double d1;
    if (localObject == null)
      d1 = 0.0D;
    while (true)
    {
      return d1;
      try
      {
        if (localObject instanceof Number)
          d1 = ((Number)localObject).doubleValue();
        if (localObject.toString().length() > 0)
        {
          double d2 = Double.valueOf(localObject.toString()).doubleValue();
          d1 = d2;
        }
        d1 = 0.0D;
      }
      catch (Exception localException)
      {
        throw new b("JSONObject[" + j(paramString) + "] is not a number.");
      }
    }
  }

  private Object i(String paramString)
  {
    if (paramString == null);
    for (Object localObject = null; ; localObject = this.b.get(paramString))
      return localObject;
  }

  private static String j(String paramString)
  {
    int i = 0;
    if ((paramString == null) || (paramString.length() == 0));
    StringBuffer localStringBuffer;
    int k;
    for (String str1 = "\"\""; ; str1 = localStringBuffer.toString())
    {
      return str1;
      int j = paramString.length();
      localStringBuffer = new StringBuffer(j + 4);
      localStringBuffer.append('"');
      k = 0;
      label46: if (k < j)
        break;
      localStringBuffer.append('"');
    }
    int l = paramString.charAt(k);
    switch (l)
    {
    default:
      if ((l >= 32) && (((l < 128) || (l >= 160))) && (((l < 8192) || (l >= 8448))))
        break label360;
      String str2 = "000" + Integer.toHexString(l);
      localStringBuffer.append("\\u" + str2.substring(str2.length() - 4));
    case 34:
    case 92:
    case 47:
    case 8:
    case 9:
    case 10:
    case 12:
    case 13:
    }
    while (true)
    {
      ++k;
      i = l;
      break label46:
      localStringBuffer.append('\\');
      localStringBuffer.append(l);
      continue;
      if (i == 60)
        localStringBuffer.append('\\');
      localStringBuffer.append(l);
      continue;
      localStringBuffer.append("\\b");
      continue;
      localStringBuffer.append("\\t");
      continue;
      localStringBuffer.append("\\n");
      continue;
      localStringBuffer.append("\\f");
      continue;
      localStringBuffer.append("\\r");
      continue;
      label360: localStringBuffer.append(l);
    }
  }

  public final boolean a(String paramString)
  {
    Object localObject = i(paramString);
    if (localObject == null);
    for (int i = 0; ; i = 1)
    {
      while (true)
      {
        return i;
        if ((!(localObject.equals(Boolean.FALSE))) && (((!(localObject instanceof String)) || (!(((String)localObject).equalsIgnoreCase("false"))))))
          break;
        i = 0;
      }
      if ((!(localObject.equals(Boolean.TRUE))) && (((!(localObject instanceof String)) || (!(((String)localObject).equalsIgnoreCase("true"))))))
        break;
    }
    throw new b("JSONObject[" + j(paramString) + "] is not a Boolean.");
  }

  public final int b(String paramString)
  {
    Object localObject = i(paramString);
    if (localObject == null);
    for (int i = 0; ; i = (int)h(paramString))
      while (true)
      {
        return i;
        if (!(localObject instanceof Number))
          break;
        i = ((Number)localObject).intValue();
      }
  }

  public final c c(String paramString)
  {
    Object localObject = i(paramString);
    if (localObject == null);
    for (c localc = null; ; localc = (c)localObject)
    {
      return localc;
      if (!(localObject instanceof c))
        break;
    }
    throw new b("JSONObject[" + j(paramString) + "] is not a JSONObject.");
  }

  public final long d(String paramString)
  {
    Object localObject = i(paramString);
    long l;
    if (localObject == null)
      l = 0L;
    while (true)
    {
      return l;
      if (localObject instanceof String)
      {
        if (localObject.toString().length() > 0)
          l = Long.valueOf(localObject.toString()).longValue();
        l = 0L;
      }
      if (localObject instanceof Number)
        l = ((Number)localObject).longValue();
      l = ()h(paramString);
    }
  }

  public final String e(String paramString)
  {
    Object localObject = i(paramString);
    if (localObject == null);
    for (String str = ""; ; str = localObject.toString())
      return str;
  }

  public final boolean f(String paramString)
  {
    return a.equals(i(paramString));
  }

  public final String toString()
  {
    String str;
    try
    {
      Iterator localIterator = this.b.keySet().iterator();
      StringBuffer localStringBuffer = new StringBuffer("{");
      if (!(localIterator.hasNext()))
      {
        localStringBuffer.append('}');
        str = localStringBuffer.toString();
        break label126:
      }
      if (localStringBuffer.length() > 1)
        localStringBuffer.append(',');
      Object localObject = localIterator.next();
      localStringBuffer.append(j(localObject.toString()));
      localStringBuffer.append(':');
      localStringBuffer.append(a(this.b.get(localObject)));
    }
    catch (Exception localException)
    {
      str = null;
    }
    label126: return str;
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     weibo4andriod.b.a.c
 * JD-Core Version:    0.5.3
 */